<div class="container-fluid">
    <div class="panel panel-default">
        <div class="panel-body">
            <div class="page-header">
                <h2>全部空间 <small><span class="badge">$count</span></small></h2>
            </div>
            #if ($count == 0)
                <div class="alert alert-info alert-dismissible fade in" role="alert" style="margin-bottom: 0">
                    <p><i class="glyphicon glyphicon-volume-up"></i> 暂时还没有空间！</p>
                </div>
            #else
            <div class="row">
                <form action="" method="get">
                    <div class="col-md-9">
                        <div class="input-group">
                        </div>
                    </div>
                    <div class="col-md-3">
                        <div class="input-group">
                            <input class="form-control" name="keyword" type="text" value="${keyword}" placeholder="空间名称/描述">
                            <span class="input-group-btn">
				              <button type="submit" class="btn btn-primary"><i class="glyphicon glyphicon-search"></i></button>
				            </span>
                        </div>
                    </div>
                </form>
            </div>
            <br>
            <table class="table" style="margin-bottom: 0">
                <thead>
                <tr>
                    <td class="w15p text-left"><strong>名称</strong></td>
                    <td class="text-left"><strong>描述</strong></td>
                    <td class="w15p text-left"><strong>标签</strong></td>
                    <td class="w15p center"><strong>访问级别</strong></td>
                    <td class="w13p center"><strong>创建时间</strong></td>
                    <td class="w13p center"><strong>操作</strong></td>
                </tr>
                </thead>
                <tbody>
                #foreach ($space in $spaces)
                <tr class="space-list">
                    <td><a href="/space/document?space_id=${space.space_id}" target="_parent" title="查看空间文档"><strong>${space.name}</strong> 
                        <span class="text text-primary"><i class="glyphicon glyphicon-new-window"></i></span></a></td>
                    <td>${space.description}</td>
                    <td class="tags-show">${space.tags}</td>
                    <td class="center">
                    #if (${space.visit_level} == "private"}
                        <label class="text text-danger">Private</label>
                    #elseif (${space.visit_level} == "internal")
                        <label class="text text-warning">Internal</label>
                    #else
                        <label class="text text-primary">Public</label>
                    #end
                    </td>
                    <td class="center">
                    ${space.create_time}
                    </td>
                    <td class="center">
                        <div class="btn-group btn-group-sm" role="group">
                        #if (${space.collection} == "1")
                            <a name="collection_space" onclick="Common.ajaxSubmit('/collection/cancel?collection_id=${space.collection_id}')"
                                type="button" class="btn btn-default"><i class="glyphicon glyphicon-star"> </i></a>
                        #else
                            <a name="collection_space" onclick="Common.ajaxSubmit('/collection/add?type=2&resource_id=${space.space_id}')" 
                                type="button" class="btn btn-default"><i class="glyphicon glyphicon-star-empty"> </i></a>
                        #end
                            <a name="user" data-link="/space/member?space_id=${space.space_id}" type="button" class="btn btn-default">
                                <i class="fa fa-group"></i></a>
                        </div>
                    </td>
                </tr>
                #end
                </tbody>
            </table>
            #end
        </div>
        <div class="panel-footer">
        #parse("paginator/default.html")
        </div>
    </div>
</div>
<script type="text/javascript">
    $(function () {
        $(".tags-show").each(function () {
            var tags = $(this).text();
            if (tags !== "") {
                var html = "";
                var tagList = tags.split(",");
                for (var i = 0; i < tagList.length; i++) {
                    html += "<span class='label label-default'>"+tagList[i]+"</span> ";
                }
                $(this).html(html);
            }
        });
    });
    Layers.bindIframe("[name='user']", "空间成员列表", "500px", "1000px");
</script>